home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo / UAppFrameAdorner.cp < prev    next >
Encoding:
Text File  |  1995-02-04  |  2.3 KB  |  98 lines  |  [TEXT/MPS ]

  1. //     Copyright © 1992 Apple Computer, Inc. All rights reserved.
  2. //     UAppFrameAdorner.cp
  3. //    Kent Sandvik DTS
  4. //    This file is used for specifying the TAppFrameAdorner member functions,
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11.  
  12. #ifndef __UAPPFRAMEADORNER__
  13. #include "UAppFrameAdorner.h"
  14. #endif
  15.  
  16.  
  17. //    Empty constructor - for avoiding ptabs in global data space
  18. #undef Inherited
  19. #define Inherited TAdorner
  20.  
  21. #pragma segment ARes
  22. DefineClass(TAppFrameAdorner, Inherited);
  23.  
  24. TAppFrameAdorner::TAppFrameAdorner()
  25. {
  26. }
  27.  
  28.  
  29. //    Draw TAppFrameAdorner Adorner method
  30. #pragma segment ARes
  31.      void TAppFrameAdorner::Draw(TView* itsView,
  32.                                    const VRect&    /*area*/)
  33. {
  34.     CRGBColor saveColor;
  35.     VRect adornArea;
  36.     CRect QDArea;
  37.     CRect tempRect;
  38.     CRGBColor anRGBGray;
  39.     RgnHandle outerRgn;
  40.     RgnHandle innerRgn;
  41.  
  42.  
  43.     PenNormal();
  44.  
  45.     itsView->GetAdornExtent(adornArea);
  46.     itsView->ViewToQDRect(adornArea, QDArea);
  47.     tempRect = QDArea;
  48.  
  49.     //     Build the region to use for filling, first create the outer region
  50.     InsetRect(QDArea, 1, 1);
  51.     outerRgn = NewRgn();
  52.     RectRgn(outerRgn, QDArea);
  53.  
  54.     //    Create the inner region
  55.     InsetRect(QDArea, 6, 6);
  56.     innerRgn = NewRgn();
  57.     RectRgn(innerRgn, QDArea);
  58.  
  59.     //    Finally subtract the inner from the outer region
  60.     DiffRgn(outerRgn, innerRgn, outerRgn);
  61.  
  62.     //    Get rid of the inner region
  63.     DisposeRgn(innerRgn);
  64.  
  65.     //    Set the foreground color to the global face color, this allows the user to
  66.     //    change the color of the face                                                                                                        
  67.     SetIfColor(gRGBLtGray);
  68.     PaintRgn(outerRgn);
  69.  
  70.     //    Get rid of the outer region
  71.     DisposeRgn(outerRgn);
  72.  
  73.     //    Draw the inside black frame
  74.     SetIfColor(gRGBBlack);
  75.     InsetRect(QDArea, 1, 1);
  76.     FrameRect(QDArea);
  77.  
  78.     //    Draw the shadows
  79.     {
  80.         //    Draw the outer gray shadow
  81.         SetIfColor(gRGBGray);
  82.         MoveTo(tempRect.left + 1, tempRect.bottom - 1);//(h, v)
  83.         LineTo(tempRect.right - 1, tempRect.bottom - 1);//(h, v)
  84.         LineTo(tempRect.right - 1, tempRect.top + 1);//(h, v)
  85.  
  86.         //    Draw the inner gray shadow    
  87.         SetIfColor(gRGBGray);
  88.         MoveTo(tempRect.left + 7, tempRect.bottom - 8);//(h, v)
  89.         LineTo(tempRect.left + 7, tempRect.top + 7);//(h, v)
  90.         LineTo(tempRect.right - 8, tempRect.top + 7);//(h, v)
  91.     }
  92.  
  93.     //    Restore the drawing environment
  94.     itsView->SetupDrawingEnvironment();
  95. }
  96.  
  97.  
  98.